<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class UserMessage extends Model
{
    protected $json = ['tags'];
    /**
     * 关联消息
     */
    public function message() {
        return $this->hasOne(SysMessage::class, 'id', 'message_id');
    }

    /** 
     * 未读消息 
     */
    public function scopeUnRead($query){
        $query->where('is_read', 0);
    }
}
